home *** CD-ROM | disk | FTP | other *** search
- Path: cocoa.brown.edu!news
- From: Jaya Kumar Kanajan <jkk@lems.brown.edu>
- Newsgroups: comp.lang.c++
- Subject: Newbie problem.
- Date: Wed, 21 Feb 1996 05:55:20 -0500
- Organization: LEMS Laboratory Brown University
- Message-ID: <312AFA18.604C@lems.brown.edu>
- NNTP-Posting-Host: lems34.lems.brown.edu
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (X11; I; SunOS 5.4 sun4m)
-
- I'm sorry for being a pest.
- But I am having the following problem and was hoping someone might have
- a quick solution.
-
- I need to read in a .pgm file and output out a text file with numerical
- values. Example:
-
- a 40x40 .pgm file stores greyscale values (0 to 255) as
- 0st row x0 x1 x2 x3 ....... x39
- 1nd row x40 x41 x42 .......
- .
- .
- .
- 39th row
-
-
- I would need to read this data in and then
- output accordingly to a text file giving
- //(xvalue) (yvalue) (colorvalue)
- //---------------------------------
- 0 0 111
- 1 0 203
- .
- .
-
-
- where each value needs to be spaced one character apart
-
-
-
- I am using Solaris 2.5 and I would really appreciate any help.
-
- Sincerely thankful for any time you spend on this.
-
- Thanks,
- -jk
-
-
-
- PS: I've been using
-
- #input <iostream.h>
- #input <fstream.h>
-
- then I was trying some cin << something
- and cout << something after loading the data into an array
- but I kept getting errors
-